package com.lineage.data.item_etcitem.html;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_SystemMessage;
import com.lineage.server.serverpackets.ServerBasePacket;
import java.util.Random;

public class Zhufudianshu extends ItemExecutor {
  Random _random = new Random();
  
  private int _zuixiao;
  
  private int _zuida;
  
  public static ItemExecutor get() {
    return new Zhufudianshu();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    try {
      if (pc == null)
        return; 
      if (pc.isDead())
        return; 
      if (pc.isPrivateShop())
        return; 
      int suijidianshu = this._zuixiao + this._random.nextInt(this._zuida - this._zuixiao);
      pc.setzhufudianshu(pc.getzhufudianshu() + suijidianshu);
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("获得祝福点数:" + suijidianshu));
      pc.getInventory().removeItem(item, 1L);
      pc.save();
    } catch (Exception exception) {}
  }
  
  public void set_set(String[] set) {
    try {
      this._zuixiao = Integer.parseInt(set[1]);
    } catch (Exception exception) {}
    try {
      this._zuida = Integer.parseInt(set[2]);
    } catch (Exception exception) {}
  }
}
